package pikes.peak;

import java.util.Map;

import org.springframework.web.servlet.support.RequestContext;

import pikes.html.xhtml.Script;
import pikes.uri.URI;

public class ScriptReference implements ClientSideScript {

	private RequestProperty<URI> source = null;

	public ScriptReference(URI source) {
		this(new RequestIndependentProperty<URI>(source));
	}

	public ScriptReference(RequestProperty<URI> source) {
		this.source = source;
	}

	final public Script createHtml(Map model, RequestContext requestContext) throws Exception {
		return new Script("text/javascript", source.getValue(model, requestContext));
	}

}
